﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;

namespace Userinterface_Ver._1_
{
    public partial class frmLogin : DevComponents.DotNetBar.Office2007Form
    {
        //private clsConnectDatabase Ketnoi;
        public frmLogin()
        {
            InitializeComponent();
        }

        private void buttonX2_Click(object sender, EventArgs e)
        {
            string sql ="select * from USERS where USER_NAME="+ "'" + txtUserName.Text + "'" + "and PASS_WORD="+"'"+ txtPassWord.Text +"'";
            OracleCommand com = new OracleCommand(sql,clsConnectDatabase.con);
            OracleDataReader dr = com.ExecuteReader();
            //com.ExecuteOracleScalar();
            if (dr.HasRows == true)
            {
                frmMain main = new frmMain();
                main.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Error ! Inconrect Username or Password !");
            }
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {
            clsConnectDatabase.Connect();
            clsConnectDatabase.OpenConnect();
            //clsConnectDatabase.con.Open();
        }

        private void groupPanel1_Click(object sender, EventArgs e)
        {

        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }

}
